<?php

class ServiceAction extends QueueActionPlugin
{

    public function main()
    {
        $callback = $this->getRequest()->getPost("callback");
        $params = $this->getRequest()->getPost("params");
        if ($callback && $params) {
            if (!isset($callback[0]) || !class_exists($callback[0])) {
                throw new \Exception("class错误", self::CODE_NOT_RETRY);
            }
            if (!isset($callback[1]) || !method_exists($callback[0], $callback[1])) {
                throw new \Exception("method错误", self::CODE_NOT_RETRY);
            }
            if (!$params) {
                throw new \Exception("params错误", self::CODE_NOT_RETRY);
            }
        } else {
            throw new \Exception("参数错误", self::CODE_NOT_RETRY);
        }
        call_user_func_array($callback, $params);
        $this->setSuccess();
    }
}